﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Controls="clr-namespace:PSE.Framework.UI.Controls.SmartClient;assembly=PSE.Framework.UI.Controls">

    <!-- BEGIN TABCONTROL -->
    
    <Style x:Key="ControlTabControlItemButtonClose" BasedOn="{x:Null}" TargetType="{x:Type Button}">
        <Setter Property="Width" Value="15"/>
        <Setter Property="Height" Value="13"/>
        <Setter Property="Background" Value="{DynamicResource BrushTabControlTabItemButtonCloseBackground}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource BrushTabControlTabItemButtonCloseBorder}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid Margin="0,1.5,0,0">
                        <Canvas>
                            <Path x:Name="Path_1" Width="12" Height="10" Canvas.Left="-3.8147e-006" Canvas.Top="0" Stretch="Fill" StrokeLineJoin="Round" Stroke="{TemplateBinding BorderBrush}" Fill="{TemplateBinding Background}" Data="F1 M 2,0.5L 13,0.5C 13.8284,0.5 14.5,1.17159 14.5,2.00001L 14.5,11C 14.5,11.8284 13.8284,12.5 13,12.5L 2,12.5C 1.17157,12.5 0.499996,11.8284 0.499996,11L 0.499996,2.00001C 0.499996,1.17159 1.17157,0.5 2,0.5 Z " StrokeThickness="0.5"/>
                            <Path x:Name="Path_4" Width="6.241" Height="5.555" Canvas.Left="2.88" Canvas.Top="2.25" Stretch="Fill" Fill="{DynamicResource BrushTabControlTabItemButtonCloseIconBackground}" Data="F1 M 4.12951,9.50011L 6.66216,6.30727L 4.43592,3.49988L 6.11158,3.49988L 7.49999,5.24996L 8.8868,3.49988L 10.5641,3.49988L 8.33782,6.30727L 10.8705,9.50011L 9.1932,9.50011L 7.49999,7.36331L 5.80517,9.50011L 4.12951,9.50011 Z "/>
                        </Canvas>
                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" RecognizesAccessKey="True"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Stroke" Value="{DynamicResource BrushTabControlTabItemButtonCloseBorderDisabled}" TargetName="Path_1"/>
                            <Setter Property="Fill" Value="{DynamicResource BrushTabControlTabItemButtonCloseBackgroundDisabled}" TargetName="Path_1"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="{x:Type Controls:TabControl}">
        <Setter Property="Padding" Value="7"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Background" Value="{DynamicResource BrushTabControlBackground}"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="TabStripPlacement" Value="Top"/>
        <Setter Property="ContextMenu" Value="{Binding SelectedTabItem.ContextMenu, RelativeSource={RelativeSource Self}}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:TabControl}">
                    <Grid ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local">
                        <Grid.RowDefinitions>
                            <RowDefinition x:Name="RowDefinition0" Height="Auto"/>
                            <RowDefinition x:Name="RowDefinition1" Height="*"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition x:Name="ColumnDefinition0"/>
                            <ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
                        </Grid.ColumnDefinitions>
                        <TabPanel x:Name="HeaderPanel" Margin="0,0,0,-1.75" Height="Auto" IsItemsHost="true" Panel.ZIndex="1" Grid.Column="0" Grid.Row="0" KeyboardNavigation.TabIndex="1" VerticalAlignment="Bottom"/>
                        <Border x:Name="ContentPanel" Grid.Column="0" Grid.Row="1" BorderBrush="{DynamicResource BrushTabControlBorder}" BorderThickness="0,0,1,1" KeyboardNavigation.DirectionalNavigation="Contained" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local" VerticalAlignment="Stretch">
                            <Border x:Name="Border" BorderBrush="{DynamicResource BrushTabControlContainerBorder}" BorderThickness="1,1,1,1">
                                <Border Background="{TemplateBinding Background}">
                                    <!--<ContentPresenter Margin="{TemplateBinding Padding}" x:Name="PART_SelectedContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="SelectedContent"/>
                                    ContextMenu="{Binding SelectedItem.ContextMenu, RelativeSource={RelativeSource TemplatedParent}}"-->
                                    <Grid x:Name="PART_SelectedContentHost" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                                </Border>
                            </Border>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Background" Value="{DynamicResource BrushTabControlBackgroundDisabled}"/>
                            <Setter Property="BorderBrush" Value="{DynamicResource BrushTabControlBorderDisabled}" TargetName="ContentPanel"/>
                            <Setter Property="BorderBrush" Value="{DynamicResource BrushTabControlBorderDisabled}" TargetName="Border"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="{x:Type Controls:TabItem}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Padding" Value="12,0,12,0"/>
        <Setter Property="BorderThickness" Value="1,1,1,0"/>
        <Setter Property="BorderBrush" Value="{DynamicResource BrushTabControlBorder}"/>
        <Setter Property="Foreground" Value="{DynamicResource BrushTabControlItemForeground}"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="IsTabStop" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:TabItem}">
                    <Border SnapsToDevicePixels="true" Height="21">
                        <Grid Margin="0,0,1,0">
                            <Grid x:Name="Transform">
                                <Border x:Name="Bd" Margin="0,2.5,0,1" Background="{DynamicResource BrushTabControlItemBackground}" BorderBrush="{DynamicResource BrushTabControlItemBorder}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3,3,0,0"/>
                                <Border x:Name="HighlightBorder" VerticalAlignment="Bottom" Height="1" BorderThickness="1,1,1,0" CornerRadius="3,3,0,0"/>
                            </Grid>
                            <Border Padding="{TemplateBinding Padding}" VerticalAlignment="Bottom">
                                <DockPanel VerticalAlignment="Center" x:Name="PART_Info">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>
                                        <ContentPresenter Grid.Column="0" x:Name="PART_Content" Margin="0,0,0,2.5" HorizontalAlignment="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" VerticalAlignment="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Header" RecognizesAccessKey="True" Style="{DynamicResource ControlFont}"/>
                                        <Button Grid.Column="1" x:Name="PART_ButtonClose" DockPanel.Dock="Right" Margin="3,0,-11,1.5" Style="{DynamicResource ControlTabControlItemButtonClose}" Command="Controls:TabControlCommands.Close" Visibility="Collapsed"/>
                                    </Grid>
                                </DockPanel>
                            </Border>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" Value="{DynamicResource BrushTabControlItemBackgroundHover}" TargetName="Bd"/>
                        </Trigger>
                        <Trigger Property="IsSelected" Value="true">
                            <Setter Property="Panel.ZIndex" Value="1"/>
                            <Setter Property="Height" Value="19"/>
                            <Setter Property="Margin" Value="0,0,0,-1.5" TargetName="PART_Info"/>
                            <Setter Property="BorderBrush" Value="{DynamicResource BrushTabControlItemBorderSelected}" TargetName="HighlightBorder"/>
                            <Setter Property="Background" Value="{DynamicResource BrushTabControlItemBorderBackgroundSelected}" TargetName="HighlightBorder"/>
                            <Setter Property="Background" Value="{DynamicResource BrushTabControlItemBackgroundSelected}" TargetName="Bd"/>
                            <Setter Property="BorderBrush" Value="{DynamicResource BrushTabControl1}" TargetName="PART_ButtonClose"/>
                            <Setter Property="Background" Value="{DynamicResource BrushTabControl2}" TargetName="PART_ButtonClose"/>
                            <Setter Property="Margin" Value="0,0,0,5" TargetName="PART_Content"/>
                            <Setter Property="Margin" Value="3,0,-11,5.5" TargetName="PART_ButtonClose"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="True" SourceName="PART_ButtonClose"/>        
                                <Condition Property="IsSelected" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="BorderBrush" Value="{DynamicResource BrushTabControlTabItemButtonCloseBorderHover}" TargetName="PART_ButtonClose"/>
                            <Setter Property="Background" Value="{DynamicResource BrushTabControlTabItemButtonCloseBackgroundHover}" TargetName="PART_ButtonClose"/>
                        </MultiTrigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter Property="BorderBrush" Value="{DynamicResource BrushTabControlItemBorderSelected}" TargetName="Bd"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="True"/>
                                <Condition Property="IsEnabled" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Margin" Value="0,0,0,0" TargetName="Bd"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsEnabled" Value="False"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Foreground" Value="{DynamicResource BrushTabControlItemForegroundDisabled}"/>
                            <Setter Property="Background" TargetName="Bd" Value="{DynamicResource BrushTabControlItemBackgroundDisabled}"/>
                            <Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource BrushTabControlTabItemDisabledBorderBrush}"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsEnabled" Value="False"/>
                                <Condition Property="IsSelected" Value="True"/>
                            </MultiTrigger.Conditions>
                            <!--<Setter Property="Margin" Value="-2,0,0,0"/>-->
                        </MultiTrigger>
                        <Trigger Property="IsClosable" Value="True">
                            <Setter Property="Visibility" Value="Visible" TargetName="PART_ButtonClose"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- END TABCONTROL -->

    <!-- BEGIN TABCONTROLBROWSER -->

    <BooleanToVisibilityConverter x:Key="boolConverter"/>
    
    <Style x:Key="RepeatButtonScrollLeftOrUpStyle" TargetType="{x:Type RepeatButton}">
        <Setter Property="Foreground" Value="{DynamicResource BrushTabControlItemForeground}" />
        <Setter Property="Background" Value="{DynamicResource BrushTabControlItemBackgroundSelected}"/>
        <Setter Property="BorderBrush" Value="{Binding Path=BorderBrush, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:TabControlBrowser}}}" />
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border x:Name="outerBorder"
						Background="{TemplateBinding Background}"
						BorderBrush="{TemplateBinding BorderBrush}"
						BorderThickness="1"
						Padding="{TemplateBinding Padding}"
						CornerRadius="3,3,0,0">

                        <Border x:Name="innerBorder" BorderThickness="1" BorderBrush="Transparent" Background="Transparent" Padding="4,0,4,0">
                            <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
                                <Path x:Name="path1" Stroke="{TemplateBinding Foreground}" Fill="Transparent" Data="M 3,0 L0,3 3,6" />
                                <Path x:Name="path2" Stroke="{TemplateBinding Foreground}" Fill="Transparent" Data="M 7,0 L4,3 7,6" />
                            </Grid>
                        </Border>

                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" Value="{DynamicResource BrushTabControlItemBackgroundHover}"/>
                            <Setter Property="Foreground" Value="{DynamicResource BrushTabControlItemForeground}" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="Background" Value="{DynamicResource BrushTabControlItemBackgroundHover}"/>
                            <Setter Property="Foreground" Value="{DynamicResource BrushTabControlItemForeground}" />
                            <Setter Property="CornerRadius" TargetName="innerBorder" Value="3,3,0,0"/>
                            <Setter Property="BorderThickness" TargetName="innerBorder" Value="1,2,1,0" />
                        </Trigger>

                        <DataTrigger Binding="{Binding Path=TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:TabControlBrowser}}}" Value="Left">
                            <Setter Property="Data" TargetName="path1" Value="M 0,3 L3,0 6,3"/>
                            <Setter Property="Data" TargetName="path2" Value="M 0,7 L3,4 6,7"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Path=TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:TabControlBrowser}}}" Value="Right">
                            <Setter Property="Data" TargetName="path1" Value="M 0,3 L3,0 6,3"/>
                            <Setter Property="Data" TargetName="path2" Value="M 0,7 L3,4 6,7"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Path=TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:TabControlBrowser}}}" Value="Bottom">
                            <Setter Property="CornerRadius" TargetName="outerBorder" Value="0,0,3,3"/>
                        </DataTrigger>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="RepeatButtonScrollRightOrDownStyle" TargetType="{x:Type RepeatButton}">
        <Setter Property="Foreground" Value="{DynamicResource BrushTabControlItemForeground}" />
        <Setter Property="Background" Value="{DynamicResource BrushTabControlItemBackgroundSelected}"/>
        <Setter Property="BorderBrush" Value="{Binding Path=BorderBrush, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:TabControlBrowser}}}" />
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border x:Name="outerBorder"
						Background="{TemplateBinding Background}"
						BorderBrush="{TemplateBinding BorderBrush}"
						BorderThickness="1"
						Padding="{TemplateBinding Padding}"
						CornerRadius="3,3,0,0">
                        <Border x:Name="innerBorder" BorderThickness="1" BorderBrush="Transparent" Background="Transparent" Padding="4,0,4,0">
                            <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
                                <Path x:Name="path1" Stroke="{TemplateBinding Foreground}" Fill="Transparent" Data="M 0,0 L3,3 0,6" />
                                <Path x:Name="path2" Stroke="{TemplateBinding Foreground}" Fill="Transparent" Data="M 4,0 L7,3 4,6" />
                            </Grid>
                        </Border>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" Value="{DynamicResource BrushTabControlItemBackgroundHover}"/>
                            <Setter Property="Foreground" Value="{DynamicResource BrushTabControlItemForeground}" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="Background" Value="{DynamicResource BrushTabControlItemBackgroundHover}"/>
                            <Setter Property="Foreground" Value="{DynamicResource BrushTabControlItemForeground}" />
                            <Setter Property="CornerRadius" TargetName="innerBorder" Value="3,3,0,0"/>
                            <Setter Property="BorderThickness" TargetName="innerBorder" Value="1,2,1,0" />
                        </Trigger>

                        <DataTrigger Binding="{Binding Path=TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:TabControlBrowser}}}" Value="Left">
                            <Setter Property="Data" TargetName="path1" Value="M 0,0 L3,3 6,0"/>
                            <Setter Property="Data" TargetName="path2" Value="M 0,4 L3,7 6,4"/>
                            <Setter Property="CornerRadius" TargetName="outerBorder" Value="0,0,3,3"/>
                            <Setter Property="CornerRadius" TargetName="innerBorder" Value="0,0,3,3"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Path=TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:TabControlBrowser}}}" Value="Right">
                            <Setter Property="Data" TargetName="path1" Value="M 0,0 L3,3 6,0"/>
                            <Setter Property="Data" TargetName="path2" Value="M 0,4 L3,7 6,4"/>
                            <Setter Property="CornerRadius" TargetName="outerBorder" Value="0,0,3,3"/>
                            <Setter Property="CornerRadius" TargetName="innerBorder" Value="0,0,3,3"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Path=TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:TabControlBrowser}}}" Value="Bottom">
                            <Setter Property="CornerRadius" TargetName="outerBorder" Value="0,0,3,3"/>
                            <Setter Property="CornerRadius" TargetName="innerBorder" Value="0,0,3,3"/>
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="DropDownToggleButtonStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Background" Value="{DynamicResource BrushTabControlItemBackgroundSelected}"/>
        <Setter Property="BorderBrush" Value="{Binding Path=BorderBrush, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:TabControlBrowser}}}"/>
        <Setter Property="Foreground" Value="{DynamicResource BrushTabControlItemForeground}"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border x:Name="outerBorder" CornerRadius="3,3,0,0" BorderThickness="1" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" >
                        <Border x:Name="innerBorder" CornerRadius="3,3,0,0">
                            <Grid HorizontalAlignment="Center" VerticalAlignment="Center" ClipToBounds="False" Margin="0,1,0,0" SnapsToDevicePixels="False">
                                <Path Stroke="{TemplateBinding Foreground}" Data="M1,1L3,4 5,1z" Fill="{TemplateBinding Foreground}" ClipToBounds="False" HorizontalAlignment="Center" VerticalAlignment="Center" SnapsToDevicePixels="True"/>
                            </Grid>
                        </Border>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" Value="{DynamicResource BrushTabControlItemBackgroundHover}"/>
                            <Setter Property="Foreground" Value="{DynamicResource BrushTabControlItemForeground}" />
                        </Trigger>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter Property="Background" Value="{DynamicResource BrushTabControlItemBackgroundHover}"/>                            
                            <Setter Property="Foreground" Value="{DynamicResource BrushTabControlItemForeground}" />
                            <Setter Property="Margin" TargetName="innerBorder" Value="-1"/>
                            <Setter Property="CornerRadius" TargetName="innerBorder" Value="3,3,0,0"/>
                            <Setter Property="BorderThickness" TargetName="innerBorder" Value="1,2,1,0" />
                        </Trigger>

                        <DataTrigger Binding="{Binding Path=TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:TabControlBrowser}}}" Value="Bottom">
                            <Setter Property="CornerRadius" TargetName="outerBorder" Value="0,0,3,3"/>
                            <Setter Property="CornerRadius" TargetName="innerBorder" Value="0,0,3,3"/>
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="NewTabButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="Background" Value="{DynamicResource BrushTabControlItemBackgroundSelected}"/>
        <Setter Property="BorderBrush" Value="{Binding Path=BorderBrush, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:TabControlBrowser}}}"/>
        <Setter Property="Foreground" Value="{DynamicResource BrushTabControlItemForeground}"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border CornerRadius="3,3,0,0" BorderThickness="1" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" x:Name="outerBorder">
                        <Border x:Name="innerBorder" CornerRadius="3,3,0,0">
                            <Grid HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" Margin="0,1,0,0" SnapsToDevicePixels="False">
                                <ContentPresenter x:Name="Cp" />
                            </Grid>
                        </Border>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" Value="{DynamicResource BrushTabControlItemBackgroundHover}"/>
                            <Setter Property="Foreground" Value="{DynamicResource BrushTabControlItemForeground}" />
                            <Setter Property="Opacity" TargetName="Cp" Value="1"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="Background" Value="{DynamicResource BrushTabControlItemBackgroundHover}"/>
                            <Setter Property="Foreground" Value="{DynamicResource BrushTabControlItemForeground}" />
                            <Setter Property="Margin" TargetName="innerBorder" Value="-1"/>
                            <Setter Property="CornerRadius" TargetName="innerBorder" Value="3,3,0,0"/>
                            <Setter Property="BorderThickness" TargetName="innerBorder" Value="1,2,1,0" />
                        </Trigger>
                        <DataTrigger Binding="{Binding Path=TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:TabControlBrowser}}}" Value="Bottom">
                            <Setter Property="CornerRadius" TargetName="outerBorder" Value="0,0,3,3"/>
                            <Setter Property="CornerRadius" TargetName="innerBorder" Value="0,0,3,3"/>
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type Controls:TabControlBrowser}">
        <Setter Property="Padding" Value="0"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Background" Value="{DynamicResource BrushTabControlBackground}"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="TabStripPlacement" Value="Top"/>
        <Setter Property="ContextMenu" Value="{Binding SelectedTabItem.ContextMenu, RelativeSource={RelativeSource Self}}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:TabControlBrowser}">
                    <Grid SnapsToDevicePixels="{Binding Path=SnapsToDevicePixels, RelativeSource={RelativeSource TemplatedParent}}" KeyboardNavigation.TabNavigation="Local">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>

                        <Border Grid.ColumnSpan="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />

                        <ToggleButton Width="16" x:Name="PART_DropDown" Height="22" VerticalAlignment="Bottom" Margin="0,0,0,-1" Grid.Column="0" KeyboardNavigation.TabIndex="1" Style="{DynamicResource DropDownToggleButtonStyle}" Visibility="{Binding Path=AllowAddNew, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource boolConverter}}" />

                        <Button x:Name="PART_NewTabButton" Grid.Column="1" Height="22" VerticalAlignment="Bottom" Margin="-1,5,0,-1" KeyboardNavigation.TabIndex="2" Style="{DynamicResource NewTabButtonStyle}" Width="24" Visibility="{Binding Path=AllowAddNew, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource boolConverter}}" Command="Controls:TabControlCommands.CreateTabItem">
                            <Grid HorizontalAlignment="Left" VerticalAlignment="Top" Width="17" Height="18">
                                <Path Stretch="Fill" Fill="{DynamicResource BrushTabControlItemForeground}" Data="F1 M1,4.8548224 L6.8778247,4.8548224 10.826735,8.4151824 10.826735,18.9716 C10.826735,19.5239 10.379035,19.9716 9.8267347,19.9716 L1,19.9716 C0.447723,19.9716 0,19.5239 0,18.9716 L0,5.8548224 C0,5.3025424 0.447723,4.8548224 1,4.8548224 z M6.4366647,6.0007824 L5.9932447,6.0007824 5.9932447,8.5997824 C5.9932447,8.9880024 6.3534747,9.3027924 6.7977747,9.3027924 L9.6137347,9.3027924 9.6137347,8.8652624 6.4366647,6.0007824 z M1.76025,10.6511 C1.40366,10.6511 1.11456,10.9402 1.11456,11.2968 1.11456,11.6534 1.40366,11.9425 1.76025,11.9425 L9.0247347,11.9425 C9.3813347,11.9425 9.6704347,11.6534 9.6704347,11.2968 9.6704347,10.9402 9.3813347,10.6511 9.0247347,10.6511 L1.76025,10.6511 z M1.76028,13.5154 C1.40366,13.5154 1.11459,13.8045 1.11459,14.1611 1.11459,14.5177 1.40366,14.8069 1.76028,14.8069 L9.0247347,14.8069 C9.3813347,14.8069 9.6704347,14.5177 9.6704347,14.1611 9.6704347,13.8045 9.3813347,13.5154 9.0247347,13.5154 L1.76028,13.5154 z M1.76028,16.5154 C1.40369,16.5154 1.11459,16.8045 1.11459,17.1611 1.11459,17.5177 1.40369,17.8068 1.76028,17.8068 L9.0247347,17.8068 C9.3813347,17.8068 9.6704347,17.5177 9.6704347,17.1611 9.6704347,16.8045 9.3813347,16.5154 9.0247347,16.5154 L1.76028,16.5154 z" Margin="0,3,0,0" x:Name="doc" HorizontalAlignment="Left" VerticalAlignment="Top" Width="11" Height="15"/>
                                <Path Fill="{DynamicResource BrushTabControlItemForeground}" Stretch="Fill" StrokeThickness="0" HorizontalAlignment="Left" Margin="9.529,0.126,0,0" x:Name="mais_doc" VerticalAlignment="Top" Width="7.5" Height="7.5" Data="M6.5000001,0 L10.5,0 10.5,6.5 17,6.5 17,10.5 10.5,10.5 10.5,17 6.5000001,17 6.5000001,10.5 0,10.5 0,6.5 6.5000001,6.5 z"/>
                            </Grid>
                        </Button>

                        <RepeatButton x:Name="PART_RepeatLeft" Panel.ZIndex="1" Grid.Column="2" Height="22" KeyboardNavigation.TabIndex="3" VerticalAlignment="Bottom" Style="{DynamicResource RepeatButtonScrollLeftOrUpStyle}" Margin="-1,5,0,-1" Visibility="{Binding ElementName=TabPanel, Path=CanScrollLeftOrUp, Converter={StaticResource boolConverter}}" Command="Controls:TabControlCommands.RepeatLeft" />

                        <ScrollViewer x:Name="PART_ScrollViewer" Grid.Column="3" Panel.ZIndex="1" CanContentScroll="True" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Hidden">
                            <Controls:VirtualizingTabPanel x:Name="TabPanel" IsItemsHost="True" SnapsToDevicePixels="True" VerticalAlignment="Bottom" />
                            <!--<VirtualizingStackPanel x:Name="TabPanel" IsItemsHost="True" SnapsToDevicePixels="True" Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Left" />-->
                        </ScrollViewer>

                        <RepeatButton x:Name="PART_RepeatRight" Panel.ZIndex="1" Grid.Column="4" Height="22" VerticalAlignment="Bottom" Style="{DynamicResource RepeatButtonScrollRightOrDownStyle}" Margin="-1,5,0,-1" Visibility="{Binding ElementName=TabPanel, Path=CanScrollRightOrDown, Converter={StaticResource boolConverter}}" Command="Controls:TabControlCommands.RepeatRight" />

                        <Border x:Name="ContentPanel" Grid.ColumnSpan="5" Grid.Row="1" 
                                BorderBrush="{DynamicResource BrushTabControlBorder}" BorderThickness="0,0,1,1"
				                KeyboardNavigation.DirectionalNavigation="Contained" KeyboardNavigation.TabIndex="5" KeyboardNavigation.TabNavigation="Local" VerticalAlignment="Stretch">

                            <Border x:Name="Border" BorderBrush="{DynamicResource BrushTabControlContainerBorder}" BorderThickness="1,1,1,1">
                                <Border Background="{TemplateBinding Background}">
                                    <!--<ContentPresenter x:Name="PART_SelectedContentHost" Content="{Binding Path=SelectedContent, RelativeSource={RelativeSource TemplatedParent}}"
                                              ContentSource="SelectedContent" ContentTemplate="{Binding Path=ContentTemplate, RelativeSource={RelativeSource TemplatedParent}}"
				                              SnapsToDevicePixels="{Binding Path=SnapsToDevicePixels, RelativeSource={RelativeSource TemplatedParent}}" 
                                              Margin="{Binding Path=Padding, RelativeSource={RelativeSource TemplatedParent}}" />-->
                                    
                                    <Grid x:Name="PART_SelectedContentHost" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                                </Border>
                            </Border>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Background" Value="{DynamicResource BrushTabControlBackgroundDisabled}"/>
                            <Setter Property="BorderBrush" Value="{DynamicResource BrushTabControlBorderDisabled}" TargetName="ContentPanel"/>
                            <Setter Property="BorderBrush" Value="{DynamicResource BrushTabControlBorderDisabled}" TargetName="Border"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type Controls:TabItemBrowser}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Padding" Value="12,0,12,0"/>
        <Setter Property="BorderThickness" Value="1,1,1,0"/>
        <Setter Property="BorderBrush" Value="{DynamicResource BrushTabControlBorder}"/>
        <Setter Property="Foreground" Value="{DynamicResource BrushTabControlItemForeground}"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="IsTabStop" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:TabItemBrowser}">
                    <Border SnapsToDevicePixels="true" Height="21" VerticalAlignment="Bottom">
                        <Grid Margin="0,0,1,0">
                            <Grid x:Name="Transform">
                                <Border x:Name="Bd" Margin="0,2.5,0,1" Background="{DynamicResource BrushTabControlItemBackground}" BorderBrush="{DynamicResource BrushTabControlItemBorder}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3,3,0,0"/>
                                <Border x:Name="HighlightBorder" VerticalAlignment="Bottom" Height="1" BorderThickness="1,1,1,0" CornerRadius="3,3,0,0"/>
                            </Grid>
                            <Border Padding="{TemplateBinding Padding}" VerticalAlignment="Bottom">
                                <DockPanel VerticalAlignment="Center" x:Name="PART_Info">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>
                                        <ContentPresenter Grid.Column="0" x:Name="PART_Content" Margin="0,0,0,2.5" HorizontalAlignment="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" VerticalAlignment="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Header" RecognizesAccessKey="True" Style="{DynamicResource ControlFont}"/>
                                        <Button Grid.Column="1" x:Name="PART_ButtonClose" DockPanel.Dock="Right" Margin="3,0,-11,1.5" Style="{DynamicResource ControlTabControlItemButtonClose}" Visibility="Collapsed" Command="Controls:TabControlCommands.Close"/>
                                    </Grid>
                                </DockPanel>
                            </Border>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Background" Value="{DynamicResource BrushTabControlItemBackgroundHover}" TargetName="Bd"/>
                        </Trigger>
                        <Trigger Property="IsSelected" Value="true">
                            <Setter Property="Panel.ZIndex" Value="1"/>
                            <Setter Property="Height" Value="19"/>
                            <Setter Property="Margin" Value="0,0,0,-1.5" TargetName="PART_Info"/>
                            <Setter Property="BorderBrush" Value="{DynamicResource BrushTabControlItemBorderSelected}" TargetName="HighlightBorder"/>
                            <Setter Property="Background" Value="{DynamicResource BrushTabControlItemBorderBackgroundSelected}" TargetName="HighlightBorder"/>
                            <Setter Property="Background" Value="{DynamicResource BrushTabControlItemBackgroundSelected}" TargetName="Bd"/>
                            <Setter Property="BorderBrush" Value="{DynamicResource BrushTabControl1}" TargetName="PART_ButtonClose"/>
                            <Setter Property="Background" Value="{DynamicResource BrushTabControl2}" TargetName="PART_ButtonClose"/>
                            <Setter Property="Margin" Value="0,0,0,5" TargetName="PART_Content"/>
                            <Setter Property="Margin" Value="3,0,-11,5.5" TargetName="PART_ButtonClose"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="True" SourceName="PART_ButtonClose"/>
                                <Condition Property="IsSelected" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="BorderBrush" Value="{DynamicResource BrushTabControlTabItemButtonCloseBorderHover}" TargetName="PART_ButtonClose"/>
                            <Setter Property="Background" Value="{DynamicResource BrushTabControlTabItemButtonCloseBackgroundHover}" TargetName="PART_ButtonClose"/>
                        </MultiTrigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter Property="BorderBrush" Value="{DynamicResource BrushTabControlItemBorderSelected}" TargetName="Bd"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="True"/>
                                <Condition Property="IsEnabled" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Margin" Value="0,0,0,0" TargetName="Bd"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsEnabled" Value="False"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Foreground" Value="{DynamicResource BrushTabControlItemForegroundDisabled}"/>
                            <Setter Property="Background" TargetName="Bd" Value="{DynamicResource BrushTabControlItemBackgroundDisabled}"/>
                            <Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource BrushTabControlTabItemDisabledBorderBrush}"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsEnabled" Value="False"/>
                                <Condition Property="IsSelected" Value="True"/>
                            </MultiTrigger.Conditions>
                        </MultiTrigger>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding Path=AllowDelete, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Controls:TabControlBrowser}}}" Value="True"/>
                                <Condition Binding="{Binding AllowDelete, RelativeSource={RelativeSource Self}}" Value="True"/>
                                <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="True"/>
                            </MultiDataTrigger.Conditions>
                            <Setter Property="Visibility" TargetName="PART_ButtonClose" Value="Visible"/>
                        </MultiDataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- END TABCONTROLBROWSER -->
    
</ResourceDictionary>
